using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DetailBox : UIBase
{
    private static string path = "UI/DetailBox";
    private static UILayer layer = UILayer.Pop;

    private string titleContent;
    private string detailContent;
    private Text mainTitle;
    private Text detailText;
    private Button closeBtn;

    protected override void Awake()
    {
        base.Awake();
        mainTitle = transform.Find("BG/Title").GetComponent<Text>();
        detailText = transform.Find("BG/Detail").GetComponent<Text>();
        closeBtn = transform.Find("CloseBtn").GetComponent<Button>();
        mainTitle.text = titleContent;
        detailText.text = detailContent;
        closeBtn.AddClickListener(Close);
    }

    public override void Open(params System.Object[] parameters)
    {
        titleContent = parameters[0] as string;
        detailContent = parameters[1] as string;
    }

    public override void Close()
    {
        DestroyImmediate(this.gameObject);
    }
}
